package com.java01.lang.io;

import java.io.Console;

public class OpenConsole {
	
	public static void main(String[] args) {
		Console console = System.console();
	    if (console == null) {
	      System.err.println("Can not get a console");
	      System.exit(1);
	    }

	    String account = console.readLine("Login as:");
	    char[] pin = console.readPassword("password:");
		String password = String.valueOf(pin);
		
		console.printf("Hello, %s\n", account);
		console.printf("I will tell everyone that your password is '%s'", password);
	}
}
